package org.jeecg.modules.demo.com.kunpeng.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.demo.com.kunpeng.entity.OaCustomer;
import org.jeecg.modules.demo.com.kunpeng.service.IOaCustomerService;
import org.jeecg.modules.demo.com.kunpeng.vo.OaCustomerContactListByShareIdVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(tags="OA客户表")
@RestController
@RequestMapping("/com.kunpeng/oaCustomer")
@Slf4j
public class OaCustomerController {

    @Autowired
    private IOaCustomerService oaCustomerService;

    /**
     * 获取客户列表
     * @param shareId
     * @return
     */
    @ApiOperation(value="OA客户表-根据共享id获取客户列表", notes="OA客户表-根据共享id获取客户列表")
    @GetMapping(value = "/oaCustomerListByShareId")
    public Result<List<OaCustomerContactListByShareIdVO>> oaCustomerListByShareId(String shareId){
        /*System.out.println("shareId:"+shareId);*/
        List<OaCustomerContactListByShareIdVO> oaCustomerListByShareIdVOS = oaCustomerService.OaCustomerListByShareIds(shareId);
        return Result.ok(oaCustomerListByShareIdVOS);
    }

    /**
     * 获取所有客户列表
     */
    @ApiOperation(value="OA客户表-获取客户列表", notes="OA客户表-获取客户列表")
    @GetMapping(value = "/oaCustomerList")
    public Result<List<OaCustomer>> oaCustomerList(){
        List<OaCustomer> oaCustomers = oaCustomerService.oaCustomerList();
        return Result.ok(oaCustomers);
    }
}
